package com.svo.weitu.activity.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.svo.weitu.R;
import com.svo.weitu.activity.MainActivity;

public class UserGuideFragment extends Fragment{
	private ImageView root;
	private int resId;

	public static UserGuideFragment newInstance(int resId) {
		UserGuideFragment fragment = new UserGuideFragment();
		fragment.resId = resId;
		return fragment;
	}
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		root = (ImageView) inflater.inflate(R.layout.userguid_item, null);
		root.setImageResource(resId);
		if (resId == R.drawable.logo) {
			root.setOnClickListener(new View.OnClickListener() {
				
				@Override
				public void onClick(View v) {
					startActivity(new Intent(getActivity(), MainActivity.class));
					getActivity().overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
					getActivity().finish();
				}
			});
		}
		return root;
	}
}
